<template>
  <div style="line-height: 60px;display:flex">
  <div style="margin-bottom: 30px">
    <el-breadcrumb separator="/" style="display: inline-block;margin-left: 10px">
      <el-breadcrumb-item :to="'/'" >首页</el-breadcrumb-item>
      <el-breadcrumb-item>{{pathName}}</el-breadcrumb-item>
    </el-breadcrumb>
  </div>
    <div style="padding-left: 1050px">
  <el-dropdown>
    <i class="el-icon-setting" style="padding-right: 10px"></i>
    <el-dropdown-menu slot="dropdown">
      <el-dropdown-item>个人信息</el-dropdown-item>
      <el-dropdown-item>
        <span  style="text-decoration: none" @click="logout">退出</span>
      </el-dropdown-item>
    </el-dropdown-menu>
  </el-dropdown>
  <span style="font-size: large">{{user.realname}}</span>
    </div>
  </div>
</template>

<script>
export default {
  name: "Header",

  computed:{
    pathName(){
      return this.$store.state.pathName;
    }
  },
  watch:{
    pathName(newVal,oldVal){
      console.log(newVal)
    }
  },
  data(){
    return{
       user:localStorage.getItem("user")?JSON.parse(localStorage.getItem("user")):{}
    }
  },


  methods:{
    logout(){
      this.$router.push("/login")
      localStorage.removeItem("user")
      this.$message.success("退出成功")
    }

  }
}
</script>

<style scoped>

</style>